package com.example.a2032.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.a2032.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class WatchFaceIndicatorAdapter extends RecyclerView.Adapter {

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new SettingViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_watchface_indicator, parent, false));
    }


    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        SettingViewHolder settingViewHolder = (SettingViewHolder) holder;

        settingViewHolder.ivIndicator.setSelected(this.position==position);


    }

    int position = 0;

    public void setSelected(int position) {
        this.position = position;
        notifyDataSetChanged();
    }

    @Override
    public int getItemCount() {
        return 3;
    }

    static class SettingViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.iv_Indicator)
        ImageView ivIndicator;

        public SettingViewHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    onItemClickListener itemClickListener;

    public void setOnItemClickListener(onItemClickListener itemClickListener) {
        this.itemClickListener = itemClickListener;
    }

    public interface onItemClickListener {
        public void onItemClick(int position);
    }
}
